<!DOCTYPE html>
<html lang="zh-cn">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>leaflet.trackplayback</title>
  <link rel="stylesheet" href="./lib/leaflet/leaflet.css">
  <link rel="stylesheet" href="../dist/control.playback.css">
  <script src="./lib/leaflet/leaflet.js"></script>
  <script src="../dist/control.trackplayback.js"></script>
  <script src="../dist/leaflet.trackplayback.js"></script>
</head>

<body>
  <a href="https://github.com/linghuam/Leaflet.TrackPlayBack"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png" alt="Fork me on GitHub"></a>
  <div id='mapid' style=" position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%; overflow: hidden;"></div>
  <script>
    const xhr = new XMLHttpRequest();
    xhr.open('GET', './data/test.json', false);
    xhr.send(null);
    const data = JSON.parse(xhr.responseText);
    const map = L.map('mapid').setView([33.74, 134.38], 6);
    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
    }).addTo(map);

    const trackplayback = L.trackplayback(data, map, {
      targetOptions: {
        useImg: true,
        imgUrl: './ship.png'
      }
    });
    const trackplaybackControl = L.trackplaybackcontrol(trackplayback);
    trackplaybackControl.addTo(map);

  </script>
</body>

</html>
